<?php $this->load->module('mobile/index/header', $common);?>
<link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/template/default/mobile/css/main.css" />
<link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/template/default/mobile/css/dialog.css" />
<link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/template/default/mobile/css/base.css" />
<link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/template/default/mobile/css/index.css" />
<link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/template/default/mobile/css/line.css" />

<script type="text/javascript" src="<?php echo URLPRE;?>static/template/default/mobile/js/mobilecommon.js"></script>
<script type="text/javascript" src="<?php echo URLPRE;?>static/template/default/mobile/js/slider.js"></script>
<script type="text/javascript" src="<?php echo URLPRE;?>static/template/default/mobile/js/dialog.js"></script>
<div class="container">
    <div class="w-item conlist">
        <dl class="fn-clear">
            <dt>温馨提示：</dt>
            <dd id="sName">欢迎您在此处留下您的联系方式，我们会在24小时之内与您取得联系！</dd>
        </dl>
    </div>
    <div class="w-item conlist">

        <dl class="fn-clear">
            <dt>线路名称：</dt>
            <dd id="sName"><?php echo $row['line_name']?></dd>
        </dl>
    </div>
    <div class="w-item marginTop">
        <dl class="in-item fn-clear borderTop">
            <dt>手机号</dt>
            <dd><input type="tel" name="phone" maxlength="11" placeholder="手机号" value="" class="writeok"></dd>
        </dl>
    </div>
    <div class="w-item">
        <dl class="in-item fn-clear">
            <dt>联系人</dt>
            <dd><input type="text" name="name" placeholder="先生/女士" value="" class="writeok"></dd>
        </dl>
    </div>


    <input type="hidden" value="<?php echo $row['line_id'];?>" name="line_id">
    <input type="hidden" value="<?php echo $row['line_name'];?>" name="line_name">
</div>
<div class="col_div">
    <a href="javascript:void(0);" class="btn btn-orange btn_submit" title="确定">确定</a>
</div>
<?php $this->load->module('mobile/index/footer',$common);?>
<script type="text/javascript">
    function alert_popup(text){
        $.dialog({
            style:'tip',
            width:200,
            closeTime:1000,
            content: '<p style="text-align: center">'+text+'</p>'
        }).open();
    }

    $(function(){
        var slid = $("#sliderimg").slider({
            loop: true
        });

        $('.btn_submit').click(function(){


            if($('input[name="name"]').val().length == 0){
                alert_popup('请输入姓名');
                return false;
            }

            if($('input[name="phone"]').val().length == 0){
                alert_popup('请输入手机号');
                return false;
            }else {
                var $val = $("input[name='phone']").val();
                var length = $val.length;
                var status = (length == 11 && /^(((17[0-9]{1})|(13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/.test($val));
                if(status==false){
                    alert_popup('请正确填写您的手机号码');
                    return false;
                }
            }



            var line_id = $('input[name="line_id"]').val();
            var line_name  = $('input[name="line_name"]').val();
            var phone  = $('input[name="phone"]').val();


            $.post('<?php echo $form_url ;?>',{
                line_id: line_id,
                line_name: line_name,
                phone: phone
            },function(data){
                alert_popup(data.info);
                if(data.status=='1')
                {
                    setTimeout(function(){
                        window.location.href='<?php echo site_url('mobile/member/center') ?>';
                    }, 1200);
                }
            },'json')
        })


    });
</script>